// pages/examtitle/examtitle.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    messages:[],//题目信息
    num:0,//部分数量
    id:0,
    zongshu:0
  },
  //科目设定
  setsubject:function(id){
    if(id==0){
      let gqzyw = [["基础知识题", "现代文阅读（一）", "现代文阅读（二）", "文言文", "古诗", "作文"],[6, 1, 1, 1, 1, 1]];
      return gqzyw;
    }
    if(id==1){
      let gqzsxw = [["选择题","填空题","解答题"],[10,10,8]];
      return gqzsxw;
    }
    if(id==2){
      let gqzsxl = [["选择题", "填空题", "解答题"], [10, 10, 8]];
      return gqzsxl;
    }
    if(id==3){
      let gqzyy = [["语音知识", "词汇与语法知识", "完形填空","阅读理解","补全对话","书面表达"], [5, 15, 1,4,1,1]];
      return gqzyy;
    }
    if(id==4){
      let zsbzz = [["选择题", "辨析题", "简答题","论述题"], [40, 2, 2,1]];
      return zsbzz;
    }
    if (id == 5) {
      let zsbyy = [["语音知识", "词汇与语法知识", "完型填空", "阅读理解","补全对话","写作"], [5, 15, 1, 4,1,1]];
      return zsbyy;
    }
    if(id == 6){
      let zsbgs1 = [["选择题", "填空题", "简答题"], [10, 10, 8]];
      return zsbgs1;
    }
    if (id == 11) {
      let zsbgs2 = [["选择题", "填空题", "简答题"], [10, 10, 8]];
      return zsbgs2;
    }
    if (id == 7) {
      let zsbyxzh = [["A型单选题", "B型单选题", "X型多选题"], [84, 24,12]];
      return zsbyxzh;
    }
    if (id == 8) {
      let gqbyw = [["基础知识题", "现代文阅读（一）", "现代文阅读（二）", "文言文", "古诗", "作文"], [6, 1, 1, 1, 1, 1]];
      return gqbyw;
    }
    if (id == 9) {
      let gqbsx1 = [["选择题", "填空题", "解答题"], [10, 10, 8]];
      return gqbsx1;
    }
    if (id == 12) {
      let gqbsx2 = [["选择题", "填空题", "解答题"], [10, 10, 8]];
      return gqbsx2;
    }
    if (id == 10) {
      let gqbyy = [["语音知识", "词汇与语法知识", "完形填空", "阅读理解", "补全对话", "书面表达"], [5, 15, 1, 4, 1, 1]];
      return gqbyy;
    }
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    console.log(options.id);
    let id = options.id
    let messages = this.setsubject(id);
    let num = messages[0].length;
    let zongshu = this.data.zongshu
    console.log(messages[1][0])
    for(let i= 0;i<messages[1].length;i++){
      zongshu=zongshu*1+messages[1][i]*1;
      console.log(zongshu)
    }
    this.setData({
      messages:messages,
      num:num,
      id:id,
      zongshu:zongshu
    })
  },
  start:function(e){
    if (this.data.id == 0 || this.data.id==8){
      wx.navigateTo({
        url: '/pages/examonline/examonline?id=' + this.data.id,
      })
    }
    if (this.data.id == 1 || 
        this.data.id == 2 ||
        this.data.id == 6 ||
        this.data.id == 11||
        this.data.id == 12||
        this.data.id == 9)
      {
        wx.navigateTo({
          url: '/pages/examonline1/examonline1?id=' + this.data.id,
        })
      }
    if (this.data.id == 3 ||
      this.data.id == 5 ||
      this.data.id == 10) {
      wx.navigateTo({
        url: '/pages/examonline2/examonline2?id=' + this.data.id,
      })
    }
    if (this.data.id == 4) {
      wx.navigateTo({
        url: '/pages/examonline3/examonline3?id=' + this.data.id,
      })
    }
    if (this.data.id == 7) {
      wx.navigateTo({
        url: '/pages/examonline4/examonline4?id=' + this.data.id,
      })
    }
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})